<%--
 *  File:    error.jsp
 *  @Author: langerwang 
 *  Date:    2001/11/08 
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ page language="java" %>  
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ page isErrorPage="true" %>

<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
	String strModuleName = "UPM";
	Category cat = Category.getInstance("jsp.error");
%>

<%@ include file="/inc/PageDefault.inc" %>

<%
	OvalCustomTable table = new OvalCustomTable(strLanguageCode, "");
	Vector errorCode = (Vector)session.getAttribute("errorcode");
  	cat.info(errorCode);
  	if(errorCode == null || errorCode.size() == 0)
  	{
    	  errorCode = new Vector();
    	}
    	String messagename = null;
    	if(errorCode.size()==0)
    	  messagename = "U_DEFAULT";
    	else if(errorCode.size()>=1)
    	  messagename = (String)((HashMap)errorCode.get(0)).get("messagecode");    	
%>
<%
    boolean isPwdError = false;
    for(int i = 0;i < errorCode.size();i++)
    {  
      java.util.HashMap errorMap = (java.util.HashMap)errorCode.get(i);
      if(errorMap.get("messagecode") != null && errorMap.get("messagecode").toString().equalsIgnoreCase("U_VUSR_02"))
      {
        isPwdError = true;
        break;
      }
    }
    if(isPwdError) 
    {
      session.removeAttribute("errorcode");
      session.setAttribute("sessionflag","Y");
      HashSet privSet = new HashSet();
      privSet.add("Z0501");
      session.setAttribute("privileges",privSet);

      response.sendRedirect("/" + ConstantProp.DEFAULT_WAR_NAME + "/masterdata/upm/ChangeExpirePassword.jsp?" + OvalTools.randomURL() + "");
      return;
    }
%>

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="./css/<%= strLanguageCode %>/main.css" type="text/css">
<%
  //for error from so credit check
  if(messagename.equalsIgnoreCase("J_OCP_BACK"))
  {
%>
<script>
//if(parent.up!=null)
//  parent.up.location.reload(true);
if(parent.up!=null&&parent.up.creditstatusname!=null)
	  parent.up.creditstatusname.innerText = "<%= label.getLabelName("L_OCPUNPassed",false)%>";  
history.go(-2);
</script>
<%
  session.removeAttribute("errorcode");
  return;
}
%>
<script>
function keydown()
{
  if(window.event.keyCode == 13)
    history.go(-1);
<%if(ConstantProp.DEFAULT_NEED_EDIT_MESSAGE){%>    
  if(event.ctrlKey && event.keyCode==49)
    window.open("console/message/MessageEdit.jsp?<%= OvalTools.randomURL() %>&editforps=y&messagename=<%=JspHelper.filterNull(messagename)%>","messagewindow","height=200,width=600");
<%}%>
}
function page_back()
{
<%if(messagename.equalsIgnoreCase("J_OCP_STOPED")||messagename.equalsIgnoreCase("J_OCP_HOLDED")){%>
if(parent.up!=null&&parent.up.creditstatusname!=null)
	  parent.up.creditstatusname.innerText = "<%= label.getLabelName("L_OCPUNPassed",false)%>";
<%}%>
  history.back();
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onkeydown="javascript:keydown();">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td > 
      <div align="center"><br>
        <br>
        <table border="0" cellspacing="0" cellpadding="30" width="434" height="271">
          <tr> 
            <td background="./images/<%= strLanguageCode %>/Error_bg.gif" valign="top"> 
              <table width="100%" border="0" height="100%" cellspacing="0" cellpadding="0">
                <tr> 
                  <td valign="top"> 
                    <p>&nbsp;</p>
                    <table width="95%" border="0" align="center" cellspacing="0" cellpadding="0">
                      <tr> 
					  &nbsp;
                        <!-- <td width="35"><img src="./images/<%= strLanguageCode %>/Error.gif"> 
                        </td>
                        <td class="error_title"><%= label.getLabelName("L_SysMsg") %></td> -->
                      </tr>
                      
                      <% 
                      	cat.debug("errorCode->" + errorCode.size());
						  for(int i=0;i<errorCode.size();i++)
  						{
  							cat.debug("er->");
  							HashMap err = (HashMap)errorCode.elementAt(i);
 				  			String messageContent = message.getMessageDesc(err,session);
  						%>
  						<tr><td>&nbsp;</td><td><% if(errorCode.size() > 1){%><%=JspHelper.filterNull( i+1 )%><%=JspHelper.filterNull( "." )%><%}%><%=JspHelper.filterNull( messageContent )%><%if(err.get("messagedetail") != null){%><%= label.getLabelName("L_LeftBracket") + err.get("messagedetail") + label.getLabelName("L_RightBracket") %><%}%></td></tr>
  					<%
  					  }
  					  if(errorCode.size() == 0)
  					  {
  					 %>  
  						<tr><td>&nbsp;</td><td><%= message.getMessageDesc("U_DEFAULT") %></td></tr>
  					<%
  					  } 
  					%>
                      
                    </table>
                    <p>&nbsp;</p>
                  </td>
                </tr>
                <tr> 
		<%
    	if(session.getAttribute("strurl")!=null && !((String)session.getAttribute("strurl")).trim().equals(""))
    	{
    	  String str=(String)session.getAttribute("strurl");
    	  session.removeAttribute("strurl");
    	%>
				<td height="1" class="td_center"><a onclick="self.location.href='<%=JspHelper.filterNull(str)%>';"><custom:button type="1" label="L_Back" imgsrc="back.gif" border="0" style="width:60"/></a></td>                      	
    	 <%}else{%>
				<td height="1" class="td_center"><a onclick="page_back();"><custom:button type="1" label="L_Back" imgsrc="back.gif" border="0" style="width:60"/></a></td>                  
				<%}%>
                </tr>
              </table>
            </td>
          </tr>
        </table>
  </div>
    </td>
  </tr>
</table>
<%
  session.removeAttribute("errorcode");
  //session.removeAttribute("strurl");
  
%>
</body>
</html>


















